#pragma once
#include <nice2d/textoption.h>
#include <nice2d/anchor.h>
#include <nice2d/spritedecorator.h>

class SpriteTextDecorator : public SpriteDecorator,public Anchor
{
    DECLARE_OBJECT(SpriteTextDecorator);
public:
    SpriteTextDecorator() = delete;
    SpriteTextDecorator(const TextOption &option);
    ~SpriteTextDecorator();
public:
    void setText(const sf::String &text);
    sf::String getText()const;

    void setTextColor(const sf::Color &color);
    sf::Color getTextColor()const;

    void updateAnchor()override;
public:
    void draw(sf::RenderTarget &target, sf::RenderStates states)const override;
    void update() override;

    PTree serialize()override;
    void deserialize(const PTree &node)override;
private:
    std::unique_ptr<class SpriteTextDecoratorData> data;
};